﻿#ifndef MAINMANAGERSERVICE_H
#define MAINMANAGERSERVICE_H

#include "imainmanagerservice.h"
#include <QObject>


#include <CFSPluginContext.h>
#include <CFSPluginActivator.h>

#include <QCoreApplication>
#include <QDebug>
#include <QFile>
#include <QDir>
#include <QDomElement>
#include <QDomDocument>
#include <QList>


namespace MainFrameGlobal {

///
/// \brief The PLUGINSTATE enum
///
enum PLUGINSTATE
{
    INSTALL,
    UNINSTALL
};

///
/// \brief The PLUGINTYPE enum
///
enum PLUGINTYPE
{
    BASE,
    NORMAL
};

///
/// \brief The XMLPluginData struct
///
struct XMLPluginData
{
    QString displayName;
    QString version;
    QString name;
    QString path;
    QString iconPath;
    PLUGINSTATE pluginState;
    PLUGINTYPE pluginType;
};

}

/**
 * @brief The MainManagerService class
 * 主界面服务实现类
 */
class MainManagerService :
        public IMainManagerService
{
    Q_OBJECT
    Q_INTERFACES(IMainManagerService)

public:
    MainManagerService(CFSPluginContext* context);
    ~MainManagerService() override;

    void readPluginXml(const QString &path, QList<MainFrameGlobal::XMLPluginData>* xmlList);
    void installPlugins(CFSPluginContext* context);
    void changeXml(const int &row);



private:
    CFSPluginContext *_context;
    QString xmlPath;
    bool m_flag;


};



#endif // MAINMANAGERSERVICE_H
